var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(e, d, c) {
    if (im.getServerName().equals("BMS单机") && im.getServerName().equals("BMS至尊体验服") && !im.getServerName().equals("BMS至尊")) {
        im.playerMessage(1, " 使用环境异常，请还原服务端配置。");
        im.dispose();
        return
    }
    if (status == 0 && e == 0) {
        im.dispose();
        return
    }(e == 1) ? status++ : status--;
    selectionLog[status] = c;
    var a = -1;
    if (status <= a++) {
        im.dispose()
    } else {
        if (status === a++) {
            var b = im.rand(1, 100);
            if (b < 70) {
                im.gainItem(im.rand(0, 3) * 1000 + 4440300, 1)
            } else {
                if (b < 90) {
                    im.gainItem(im.rand(0, 3) * 1000 + 4440200, 1)
                } else {
                    im.gainItem(im.rand(0, 3) * 1000 + 4440100, 1)
                }
            }
            im.gainItem(2630972, -1);
            im.dispose()
        }
    }
};